import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// import { fileURLToPath, URL } from 'node:url'
import path from 'path';

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    react(),
  ],
  resolve: {
    alias: {
      '@':path.resolve(__dirname,'./src')
      // '@components': path.resolve(__dirname, './src/components'),  // 别名指向 src/components 文件夹
      // '@assets': path.resolve(__dirname, './src/assets'),  // 别名指向 src/assets 文件夹
    }
  },
  server: {
    host: '0.0.0.0',
    port: 5555,
    open: false,
    proxy: {
      '/admin-api': {
        target: 'http://172.16.1.120:8233/',
        // target: 'http://10.10.10.171:8233',
        changeOrigin: true,
        rewrite: (p) => p.replace(/^\/admin-api/, '')
      }
    }
  },
})
